#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[100005];
bool b[100005],c[100005];
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,ans;
    cin>>n;
    ans = n;
    int f = 1;
    for(int i = 1; i <= n; i++){
        cin>>a[i];
        if(a[i] > 2)f = 0;
        b[i] = c[i] = true;
    }
    if(f){
        int sa=0,sb=0,cnt;
        for(int i = 1; i <= n; i++)
        {
            if(a[i] == 1)sa++;
            else if(a[i] == 2)sb++;
        }
        if(sb <= sa)cnt = n - sb;
        else cnt = n - sa;
        cout<<cnt<<endl;
        return 0;
    }
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    for(int i = n; i >= 1; i--)
    {
        if(c[i])int ee = a[i];
        for(int j = i - 1; j >= 1; j--)
        {
            if(a[j] > a[i] && b[j])
            {
                b[j] = false;
                c[i] = false;
                ans -= 1;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
